package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.MarketTopic;
import com.cskaoyan.bean.common.BasePageInfo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.bean.vo.WxTopicDetailVo;
import com.cskaoyan.service.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.crypto.Data;

/**
 * @author yi
 * @date 2022/10/14 14:31
 */

@RestController
@RequestMapping("wx/topic")
public class WxTopicController {
    @Autowired
    WxTopicService wxTopicService;

    @RequestMapping("list")
    public BaseRespVo list(BasePageInfo basePageInfo) {
        CommonData<MarketTopic> data = wxTopicService.queryTopic(basePageInfo);
        return BaseRespVo.ok(data, "成功");
    }

    @RequestMapping("detail")
    public BaseRespVo detail(Integer id) {
        WxTopicDetailVo wxTopicDetailVo = wxTopicService.queryTopicDetail(id);
        return BaseRespVo.ok(wxTopicDetailVo, "成功");
    }

    @RequestMapping("related")
    public BaseRespVo related(Integer id) {
        CommonData<MarketTopic> data = wxTopicService.queryTopicRelated(id);
        return BaseRespVo.ok(data, "成功");
    }
}
